/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1635217140048_9709';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  config.mongoose = {
    url: process.env.EGG_MONGODB_URL || 'mongodb://localhost/xmApiDb',
    options: {
      poolSize: 40,
      useUnifiedTopology:true
    } 
  }
  const crypto = require('crypto')
  config.jwt = {
    secret: crypto.randomBytes(32).toString('hex')
  }

  config.security = {
    csrf: {
      enable: false,
      ignoreJSON: true
    },
    domainWhiteList: ['*']
  }

  config.cors = {
    origin: '*',
    allowMethods:'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS'
  }
  //配置api地址
  config.api = 'http://www.phonegap100.com/'
  return {
    ...config,
    ...userConfig,
  };
};
